package com.sofoscorp.android.gestcobranzamobile;

import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;

public class ConexionDB {
	private String gv_pathDB = null;
	private String gv_tabName = null;
	private SQLiteDatabase go_DB; 
	public String C_PATH_FROMSAP = "/data/data/com.sofoscorp.android.initdb/databases/FromSAP";
	public String C_PATH_TOSAP = "/data/data/com.sofoscorp.android.initdb/databases/ToSAP";
	
	public void serialization(String iv_pathDB){
		this.gv_pathDB = iv_pathDB;
	}
	
	public void serialization(String iv_pathDB, String iv_tabname){
		this.gv_pathDB = iv_pathDB;
		this.gv_tabName = iv_tabname;
	}
	
	public boolean checkConexDB(){
		//Aperturar DB FromSAP en modo escritura y lectura  
		try {
			go_DB = SQLiteDatabase.openDatabase(this.gv_pathDB, null, SQLiteDatabase.OPEN_READWRITE);
		} catch (SQLiteException e) {
			go_DB = null;
		}    
		
		if (go_DB != null) {    
			//go_DB.close();
		}    
		return go_DB != null ? true : false; 
	}

	public SQLiteDatabase getGo_DB() {
		return go_DB;
	}
	
}
